﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Core.Menu
{
	using System.Collections.Generic;

	public class MenuItemBuilder : IMenuItemBuilder
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="MenuItemBuilder"/> class.
		/// </summary>
		public MenuItemBuilder()
		{
			this.Items = new List<MenuItem>();
		}

		/// <summary>
		/// Gets or sets the items.
		/// </summary>
		/// <value>The items.</value>
		public IList<MenuItem> Items
		{
			get; 
			private set;
		}

		/// <summary>
		/// Adds the specified menu item.
		/// </summary>
		/// <param name="text">The text.</param>
		/// <param name="route">The route.</param>
		/// <param name="conditions">The conditions.</param>
		public void Add(string text, string route, object conditions)
		{
			this.Items.Add(new MenuItem
			{
				Text = text,
				Route = route,
				Conditions = conditions
			});
		}

		/// <summary>
		/// Adds the specified menu item.
		/// </summary>
		/// <param name="text">The text.</param>
		/// <param name="route">The route.</param>
		/// <param name="parameters">The parameters.</param>
		/// <param name="conditions">The conditions.</param>
		public void Add(string text, string route, object parameters, object conditions)
		{
			this.Items.Add(new MenuItem
			{
				Text = text,
				Route = route,
				Parameters = parameters,
				Conditions = conditions
			});
		}
	}
}